<?php

use common\modules\attachment\widgets\SingleWidget;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\Live */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="box box-primary">
    <div class="box-body">
    <?php $form = ActiveForm::begin(); ?>
    
    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?php echo $form->field($model, 'share_img')->widget(SingleWidget::className()) ?>
    
    <?php if (!$model->isNewRecord): ?>
    
    <?php if($model->type=='url'):?>
    	<?= $form->field($model, 'url')->textInput() ?>
    <?php else :?>
    	<?= $form->field($model, 'live_replay')->textarea() ?>
    <?php endif;?>
    <?php else :?>
    <?= $form->field($model, 'url')->textInput() ?>
    <?php endif;?>
    
    <?= $form->field($model, 'sort')->textInput() ?>
    
    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?>
    </div>

    <?php ActiveForm::end(); ?>
    </div>
</div>
